package com.fejal.bean;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;


@Entity
public class ProfessorDisciplina implements Serializable{

	private static final long serialVersionUID = -3808684477275539136L;

	@Id
	@GeneratedValue (strategy = GenerationType.AUTO)
	private int codigoProfessorDisciplina;
	
	@OneToOne	
	@JoinColumn(name = "codigoProfessor")	
	private Professor professor;
	
	private int cargaHoraria;

	
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "codigoTurmaOfertaDisciplina", insertable = true, updatable = true)
	@Fetch(FetchMode.JOIN)
	@Cascade(CascadeType.SAVE_UPDATE)	
	private TurmaOfertaDisciplina turmaOfertaDisciplina;
	
	public ProfessorDisciplina(){

	}

	public int getCodigoProfessorDisciplina() {
		return codigoProfessorDisciplina;
	}

	public void setCodigoProfessorDisciplina(int codigoProfessorDisciplina) {
		this.codigoProfessorDisciplina = codigoProfessorDisciplina;
	}

	public Professor getProfessor() {
		return professor;
	}

	public void setProfessor(Professor professor) {
		this.professor = professor;
	}

	public int getCargaHoraria() {
		return cargaHoraria;
	}

	public void setCargaHoraria(int cargaHoraria) {
		this.cargaHoraria = cargaHoraria;
	}

	public TurmaOfertaDisciplina getTurmaOfertaDisciplina() {
		return turmaOfertaDisciplina;
	}

	public void setTurmaOfertaDisciplina(TurmaOfertaDisciplina turmaOfertaDisciplina) {
		this.turmaOfertaDisciplina = turmaOfertaDisciplina;
	}


}